<template>
  <uni-popup
    class="pop"
    ref="popupRef"
    type="center"
    :animation="true"
  >
    <view class="pop-content">
		<text>删除社区</text>
		<view class="choice-button">
			<view class="submit" @click="cancalSignin">
				取消
			</view>
			<view class="cancal" @click="submitSignin">
				确定
			</view>
			
		</view>
    </view>
  </uni-popup>
</template>

<script setup>
import { ref } from 'vue';
import { DeleteMyCommit } from '@/config/API/commit';
const popupRef = ref(null);
const emits = defineEmits(['cancalSignin','submitSignin'])
const cancalSignin =()=>{
	 popupRef.value.close();
}

const submitSignin = async() =>{
	console.log('选中要删除的==》',itemFrom.value)
	
	const submitData = await DeleteMyCommit(itemFrom.value.CommunityID)
	if(submitData.code==200){
		emits('submitSignin',itemFrom.value)
		popupRef.value.close();
	}else{
		uni.showToast({
			title: '删除失败',
			icon: "none"
		});
	}
	console.log('删除结果',submitData)
	// popupRef.value.close();
}
const itemFrom = ref()
const exposeMethods = {
  showPopup: (item) => {
	  console.log('删除',item)
	  itemFrom.value=item
    popupRef.value.open();
  },
  closePopup: () => {
    popupRef.value.close();
  }
};

defineExpose({
  ...exposeMethods
});
</script>

<style scoped>
.pop-content {
  /* 添加样式 */
  background-color: #FFFFFF;
  padding: 50rpx 42rpx 42rpx 42rpx;
  border-radius: 36rpx;
  display: flex;
  flex-direction: column;
  gap: 26rpx;
  font-family: Lantinghei SC, Lantinghei SC;
  
  font-size: 24rpx;
  color: rgba(0,19,76,0.9);
  line-height: 44rpx;
  text-align: center;
  font-style: normal;
  text-transform: none;
}
.pop-content text{
	
	font-family: Lantinghei SC, Lantinghei SC;
	font-weight: 600;
	font-size: 32rpx;
	color: rgba(0,19,76,0.9);
	line-height: 44rpx;
	text-align: center;
	font-style: normal;
	text-transform: none;
}
.choice-button{
	display: flex;
	width: 40vw;
	justify-content: space-between;
	
}
.choice-button .submit{
	border-radius: 86rpx;
	border: 2rpx solid rgba(0, 0, 0, 0.28);
	    padding: 15rpx 45rpx;
	font-family: Lantinghei SC, Lantinghei SC;
	
	font-size: 28rpx;
	color: rgba(204, 204, 204, 0.9);
	line-height: 44rpx;
	text-align: left;
	font-style: normal;
	text-transform: none;
}
.choice-button .cancal{
	border-radius: 86rpx;
	border: 2rpx solid #04046c;
	    padding: 15rpx 45rpx;
	font-family: Lantinghei SC, Lantinghei SC;
	font-weight: 600;
	font-size: 28rpx;
	color: #04046c;
	line-height: 44rpx;
	text-align: left;
	font-style: normal;
	text-transform: none;
}
</style>